Method and apparatus for real-time SAO parameter estimation

ABSTRACT

The disclosure provides a sample adaptive offset (SAO) encoder. The SAO encoder includes a statistics collection (SC) block and a rate distortion optimization (RDO) block coupled to the SC block. The SC block receives a set of deblocked pixels and a set of original pixels. The SC block categorizes each deblocked pixel of the set of deblocked pixels in at least one of a plurality of band and edge categories. The SC block estimates an error in each category as difference between a deblocked pixel of the set of deblocked pixels and corresponding original pixel of the set of original pixels. The RDO block determines a set of candidate offsets associated with each category and selects a candidate offset with a minimum RD cost. The minimum RD cost is used by a SAO type block and a decision block to generate final offsets for the SAO encoder.

CROSS REFERENCES TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/889,962 filed on Jun. 2, 2020, which is a continuation of U.S. patentapplication Ser. No. 16/432,453 filed on Jun. 5, 2019 (now U.S. Pat. No.10,715,815), which is a continuation of U.S. patent application Ser. No.15/970,497 filed on May 3, 2018, (now U.S. Pat. No. 10,321,135) which isa continuation of U.S. patent application Ser. No. 15/367,378 filed onDec. 2, 2016, (now U.S. Pat. No. 9,967,569) which is a continuation ofU.S. patent application Ser. No. 14/447,062, filed on Jul. 30, 2014,which claims priority from India Provisional Patent Application No.3400/CHE/2013 filed on Jul. 30, 2013, the entireties of which are allhereby incorporated by reference.

TECHNICAL FIELD

Embodiments of the disclosure relate generally to video coding and moreparticularly to a SAO filter used in video coding standards such asH.264 and H.265.

BACKGROUND

High Efficiency Video Coding (HEVC) is a video coding standard beingdeveloped jointly by ITU-T, also known as the Video Coding Experts Group(VCEG), and by ISO/IEC, also known as the Moving Picture Experts Group(MPEG) in the joint collaborative team on video coding (JCT-VC).

A video input signal has multiple frames. HEVC divides a frame intorectangular blocks or LCU (largest coding unit) or macro-blocks of16×16, 32×32 or 64×64. An optimal size of the LCU is selected based onthe video content. The rectangular blocks can be predicted frompreviously decoded data either by motion compensated prediction or intraprediction. The resulting prediction error is coded by applying blocktransforms based on an integer approximation of the discrete cosinetransform which is followed by the quantization and coding of thetransform coefficients.

Transform coding with quantization is a type of data compression whichis commonly “lossy” as the quantization process discards a portion ofdata associated with the transform of the video input, thereby loweringits bandwidth requirement but often also results in quality loss in thereconstructed video.

SAO (Sample Adaptive Offset) encoder is placed in a reconstruction loopof a video encoder and it is placed in the video encoder after ade-blocking filter. SAO is a process of adding offset to de-blockedpixels received from the de-blocking filter. The offset reduces thedistortion in the reconstructed image and thus provides a reconstructedvideo with high quality and PSNR (peak signal to noise ratio) andsimultaneously achieving bitrate reduction. SAO encoder is a computationintensive block in HEVC and increases the video decoder/encodercomplexity. Therefore, SAO encoder process needs to be optimized tominimize the computational complexity while maximizing bitrate saving,improving visual quality and maintaining compliance set by the HEVCstandard.

SUMMARY

This Summary is provided to comply with 37 C.F.R. § 1.73, requiring asummary of the invention briefly indicating the nature and substance ofthe invention. It is submitted with the understanding that it will notbe used to interpret or limit the scope or meaning of the claims.

An embodiment provides a sample adaptive offset (SAO) encoder. The SAOencoder includes a statistics collection (SC) block that receives a setof deblocked pixels and a set of original pixels. The SC blockcategorizes each deblocked pixel of the set of deblocked pixels in atleast one of a plurality of band categories and a plurality of edgecategories. The SC block counts a number of deblocked pixels in eachcategory of the plurality of band categories and the plurality of edgecategories and also estimates an error in each category from adifference between a deblocked pixel of the set of deblocked pixels andcorresponding original pixel of the set of original pixels.

The SAO encoder also includes a rate distortion optimization (RDO) blockthat is coupled to the SC block. The RDO block determines a sign of theerror in each category, and also determines a set of candidate offsetsassociated with each category. A value of a candidate offset of the setof candidate offsets is between a maximum candidate offset and a minimumcandidate offset. The RDO block estimates a rate distortion (RD) costassociated with each candidate offset of the set of candidate offsetsdetermined for each category. The RDO block also determines a minimum RDcost of the estimated RD costs for each category.

Other aspects and example embodiments are provided in the Drawings andthe Detailed Description that follows.

BRIEF DESCRIPTION OF THE VIEWS OF DRAWINGS

FIG. 1 illustrates a block diagram of a video encoder;

FIG. 2 illustrates a block diagram of a SAO (sample adaptive offset)encoder, according to an embodiment;

FIG. 3(a) illustrates a block diagram of a RDO (rate distortionoptimization) block, according to an embodiment;

FIG. 3(b) illustrates a block diagram of an RD (rate distortion) costestimation block, according to an embodiment;

FIG. 4(a) illustrates a block diagram of a SAO (sample adaptive offset)type block, according to an embodiment;

FIG. 4(b) illustrates a block diagram of a cost estimation module,according to an embodiment;

FIG. 5 illustrates a block diagram of a decision block, according to anembodiment;

FIG. 6 is an example environment in which various aspect of the presentdisclosure may be implemented; and

FIG. 7 illustrates a method of generating final offsets in a SAOencoder, according to an embodiment.

DETAILED DESCRIPTION OF THE EMBODIMENTS

FIG. 1 illustrates a block diagram of a video encoder 100. The videoencoder 100 receives a video input 102. A subtractor 104 in the videoencoder 100 receives the video input 102. A transform and quantizationunit 106 is coupled to the subtractor 104. An entropy coder 108 and aninverse transform and quantization unit 112 are coupled to the transformand quantization unit 106. The entropy coder 108 generates a coded videooutput 110. The inverse transform and quantization unit 112 is coupledto a summer 114.

A deblocking filter 116 is coupled to the summer 114. A SAO encoder 118,coupled to the deblocking filter 116, receives the video input 102. Theentropy coder 108 is coupled to the SAO encoder 118. A reference picturebuffer 120 is coupled to the SAO encoder 118. A motion compensation unit122 is coupled to the reference picture buffer 120 and provides anoutput to the summer 114 and the subtractor 104. The inverse transformand quantization unit 112, the summer 114, the deblocking filter 116,the SAO encoder 118, the reference picture buffer 120 and the motioncompensation unit 122 together form a reconstruction loop of the videoencoder 100.

The operation of the video encoder 100 illustrated in FIG. 1 isexplained now. The video input 102 has multiple frames. A frame isdivided into rectangular blocks or LCU (largest coding units) ormacro-blocks and each LCU includes a plurality of pixels. The transformand quantization unit 106 performs transform and quantization on anoriginal LCU received from the subtractor 104. The transform andquantization unit 106 performs a discrete cosine transform (DCT). Thetransform and quantization unit 106 transforms the pixel data into aspatial frequency domain. This frequency domain data is quantized toform a quantization block.

The inverse transform and quantization unit 112 inversely quantizes thequantization block and performs inverse transform on the result ofinverse quantization. As an example, if DCT is performed in thetransform and quantization unit 106, inverse DCT is performed in theinverse transform and quantization unit 112.

The deblocking filter 116 smoothens artifacts created by the macroblocknature of the encoding process. The SAO encoder 118 adds an offset todeblocked pixels received from the deblocking filter 116. The offsetreduces the distortion in the reconstructed LCU. The reference picturebuffer 120 stores the reconstructed LCU. The motion compensation unit122 performs motion compensation on the motion information received inthe reconstructed LCU received from the reference picture buffer 120 togenerate a motion compensated LCU. The subtractor 104 subtracts themotion compensated LCU from the original LCU to generate a differentialdata. Thus, the transform and quantization unit 106 and the entropycoder 108 encodes the differential data rather than the original LCU.

The entropy coder 108 encodes the quantized data received from thetransform and quantization unit 106 to generate the coded video output110. Entropy coder 108 employs a fewer bits to encode more frequentlyused symbols and more bits to encode less frequently used symbols. Thisprocess reduces the amount of encoded data that is to be transmittedand/or stored by the entropy coder 108.

FIG. 2 illustrates a block diagram of a SAO (sample adaptive offset)encoder 200, according to an embodiment. The SAO encoder 200 includes astatistics collection (SC) block 206. The SC block 206 receives a set ofdeblocked pixels 202 and a set of original pixels 204. A rate distortionoptimization (RDO) block 208 and a merge mode block 212 are coupled tothe SC block 206. A SAO type block 210 is coupled to the RDO block 208and the SC block 206. A decision block 216 is coupled to the SAO typeblock 210 and the merge mode block 212. The SAO encoder 200 may includeone or more additional components known to those skilled in the relevantart and are not discussed here for simplicity of the description.

The operation of the SAO encoder 200 illustrated in FIG. 2 is explainednow. The SC block 206 receives the set of deblocked pixels 202 and theset of original pixels 204. The set of original pixels 204 correspondsto a current LCU. A deblocking filter (not illustrated in FIG. 2 )generates the set of deblocked pixels 202. The current LCU includes aluma component and a chroma component. The chroma component furtherincludes a Cb component and a Cr component. The SC block 206 categorizeseach deblocked pixel of the set of deblocked pixels 202 in at least oneof a plurality of band categories and a plurality of edge categories. Inone example, the SAO encoder 200 includes 32 band categories and 4 edgetypes. Each of the four edge types are further sub-divided into fouredge categories. Therefore, there are a total of 16 edge categories anda total of 48 categories (32 band categories and 16 edge categories).

In another example, the 32 band categories are B0, B1 till B31. The fouredge types are 0 degree, 90 degree, 135 degree and 45 degree. Each ofthese edge types is further sub divided into edge categories defined ascategory 1, category 2, category 3 and category 4. In yet anotherexample, the band categories and the edge categories are compliant withthe HEVC standard.

Each deblocked pixel is categorized into one of these categories. In oneexample, a deblocked pixel is categorized in multiple edge categories.In another example, a deblocked pixel is categorized in multiple edgetypes. For example, a deblocked pixel categorized in edge type 0degree-category 1, is also categorized in edge type 135 degree-category2. In yet another example, the SC block 206 discards a deblocked pixelif the SC block 206 is not able to categorize a deblocked pixel in anyof these categories. The SC block 206 counts a number of deblockedpixels in each category of the plurality of band categories and theplurality of edge categories. The SC block 206 estimates an error ineach category from a difference between a deblocked pixel of the set ofdeblocked pixels 202 and corresponding original pixel of the set oforiginal pixels 204.

The RDO block 208 receives the estimated error in each category and thecount of the number of deblocked pixels in each category from the SCblock 206. The RDO block 208 determines a sign of the estimated error ineach category. The sign is a positive sign or a negative sign. The RDOblock 208 determines a set of candidate offsets for each category. Avalue of a candidate offset of the set of candidate offsets is between amaximum candidate offset and a minimum candidate offset. In an example,when a video input processed by the SAO encoder 200 is an 8 bit input,the set of candidate offsets are integers from 0 to +7. In anotherexample, when the video input processed by the SAO encoder 200 is a 10bit input, the set of candidate offsets are integers from 0 to +31.

The RDO block 208 estimates a rate distortion (RD) cost for eachcandidate offset of the set of candidate offsets determined in eachcategory. The RDO block 208 estimates the RD cost associated with eachcandidate offset using the count of the number of deblocked pixels inthe category and an absolute value of the estimated error in thatcategory. The RDO block 208 also uses a bitrate data from a look-uptable stored in the SAO encoder 200 for estimating the RD costassociated with each candidate offset.

In one example, when the sign of the estimated error in a category is apositive sign, the set of candidate offsets are 0, 1, 2 till 7. Thus,the RDO block 208 estimates an RD cost for each of these candidateoffsets. The RDO block 208 determines a minimum RD cost of the estimatedRD costs for each category. In the above example, when there are 48categories, the RDO block 208 determines a minimum RD cost for each ofthese 48 categories. The RDO block 208 also maintains a record of thecandidate offset for which the minimum RD cost is obtained for acategory. For example, when the set of candidate offsets are 0, 1, 2till 7 for a category, the RDO block 208 estimates an RD cost for eachof these candidate offset. Now, if for a candidate offset 2, the RD costobtained is minimum, the RDO block 208 provides this minimum RD cost andthe corresponding candidate offset (i.e. candidate offset 2) to the SAOtype block 210.

In addition, the RDO block 208 modifies a sign of the correspondingcandidate offset, for which the minimum RD cost is obtained, based onthe sign of the estimated error in each category. For example, when asign of the estimated error in a category is negative, the RDO block 208changes a sign of the corresponding candidate offset to negative forwhich the minimum RD cost is obtained for that category.

The SAO type block 210 receives the minimum RD cost and thecorresponding candidate offset for each category from the RDO block 208.The SAO type block 210 generates a set of band SAO types such that eachband SAO type of the set of band SAO types includes a set of bandcategories. Thus, the SAO type block 210 combines a set of bandcategories to generate a band SAO type. For example, the SAO type block210 combines a first four categories of the plurality of band categoriesto generate a first SAO type and the SAO type block 210 combines a nextfour categories of the plurality of band categories to generate a secondSAO type.

Similarly, the SAO type block 210 generates a set of edge SAO types suchthat each edge SAO type of the set of edge SAO types comprises a set ofedge categories. For example, the SAO type block 210 combines a set ofedge categories of the plurality of edge categories to generate an edgeSAO type. The SAO type block 210 estimates a band cost associated witheach band SAO type. The band cost associated with a band SAO type isestimated by summing the minimum RD cost associated with each categorythat is combined to form the band SAO type. In one example, a set ofband categories (B0, B1, B2 and B3) are combined to form a first bandSAO type and a minimum RD cost for the respective band categories is 2,5, 7 and 4. The band cost associated with the first band SAO type is 18(2+5+7+4=18).

The SAO type block 210 determines a minimum band cost of the estimatedband costs. The SAO type block 210 maintains a record of a set of bandcategories combined to form the band SAO type for which the minimum bandcost is obtained and the corresponding candidate offsets associated witheach band category of the set of band categories. The SAO type block 210provides the minimum band cost, the corresponding SAO type along withthe corresponding candidate offsets associated with each band categoryof the set of band categories to the decision block 216.

Similarly, the SAO type block 210 estimates an edge cost associated witheach edge SAO type. The edge cost associated with an edge SAO type isestimated by summing the minimum RD cost associated with each edgecategory combined to form the edge SAO type. The SAO type block 210provides the edge cost associated with each edge SAO type andcorresponding candidate offsets associated with each edge categorycombined to form the edge SAO type, to the decision block 216.

Table 1 illustrates the operation of the SC block 206 and the RDO block208.

TABLE 1 SC block RDO block Deblocked Corresponding Pixel CandidateMinimum candidate Category Count Error Offsets RD cost RD cost offset B023 178 0 to +7 16, −317, −588, −829, −1024, −1157, −1260, −1317 −1317 7B1 64 151 0 to +7 16, −222, −316, −298, −152, 138, 540, 1070 −316 2 B2 433 0 to +7 16, −46, −84, −130, −168, −182, −204, −218 −218 7 B3 27 187 0to +7 16, −331, −608, −847, −1032, −1147, −1224, −1247 −1247 7 B4 7 −210 to +7 16, −19, −24, −31, −24, 13, 48, 97 −31 −3 E0 64 558 0 to +7 16,−1036, −1944, −2740, −3408, −3932, −4344, −46 −4628 7 E1 43 124 0 to +716, −189, −292, −325, −272, −117, 108, 419 −325 3 E2 56 −208 0 to +7 16,−344, −576, −712, −736, −632, −432, −120 −736 −4 E3 4 −23 0 to +7 16,−26, −44, −70, −88, −82, −84, −78 −88 −4

In Table 1, B0-B4 are band categories of the plurality of bandcategories and E0-E3 are edge categories of the plurality of edgecategories. The SC block 206 counts the number of deblocked pixels ineach category and estimates an error in each category as represented incolumn ‘Deblocked pixel count’ and ‘Error’ respectively.

The RDO block 208 determines the set of candidate offsets. The RDO block208 estimates a RD cost associated with each candidate offset asillustrated in column ‘RD cost’. The RDO block 208 determines theminimum RD cost of the estimated RD costs for each category. Forexample, as illustrated in Table 1, the minimum RD cost for bandcategory B0 is −1317 and for edge category E2 is −736. The RDO block 208modifies a sign of the corresponding candidate offset for which theminimum RD cost is obtained for a given category. For example, for bandcategory B4, a minimum RD cost is obtained for offset 3, the RDO block208 modifies the sign of the offset and the corresponding candidateoffset for band category B4 is −3.

Table 2 illustrates the operation of the SAO type block 210.

TABLE 2 SAO Type Block Band Minimum Corresponding Corresponding SAO TypeBand Categories Band Cost Band cost categories candidate offsets BO0 B0,B1, B2 and B3 1317 −316 −218 −1247 = −3098 −3098 B0, B1, B2 and B3 7, 2,7, 7 BO1 B1, B2, B3 and B4 −316 −218 −1247 −31 = −1812 Edge SAO TypeEdge Cost EO E0, E1, E2 and E3 −4628 −325 −736 −88 = −5777

Table 2 illustrates Band SAO type BO0 and BO1. The SAO type block 210generates Edge SAO type EO. The SAO type block 210 estimates the bandcost associated with each band SAO types by summing the minimum RD costassociated with each band category combined to form the band SAO type.For example, the band cost for band SAO type BO0 is estimated by summingthe minimum RD cost associated with B0, B1, B2 and B3. Similarly, theSAO type block 210 estimates the edge cost associated with each edge SAOtype.

The SAO type block 210 determines a minimum band cost of the estimatedband costs. As illustrated in column ‘Minimum Band Cost’ the SAO typeblock 210 determines that the minimum band cost is −3098 of all theestimated band costs. The SAO type block 210 maintains a record of thecorresponding categories (B0, B1, B2 and B3) for which the minimum bandcost is obtained and also the corresponding candidate offsets (7, 2, 7,7) for these categories (B0, B1, B2 and B3) respectively.

The SAO type block 210 provides the edge cost associated with each edgeSAO type and corresponding candidate offsets associated with each edgecategory combined to form the edge SAO type, to the decision block 216.Thus, the SAO type block 210 provides edge SAO type EO to the decisionblock 216 along with the estimated edge costs. The SAO type block 210also maintains a record of the corresponding candidate offsets for eachof the edge categories combined to form the edge SAO type.

The merge mode block 212 receives the count of the number of deblockedpixels in each category and the estimated error in each category. Themerge mode block 212 also receives a set of parameters 214. The set ofparameters 214 includes a final left SAO type associated with a leftLCU. The left LCU is adjacent to the current LCU and spatiallypositioned on left side of the current LCU. The merge mode block 212also receives final offsets corresponding to the final left SAO typeassociated with the left LCU. The merge mode block 212 estimates a leftmerge cost associated with the current LCU from the final offsetsassociated with the left LCU.

The set of parameters 214 also includes a final top SAO type associatedwith a top LCU. The top LCU is adjacent to the current LCU and spatiallypositioned on top of the current LCU. The merge mode block 212 alsoreceives final offsets corresponding to the final top SAO typeassociated with the top LCU. The merge mode block 212 estimates a topmerge cost associated with the current LCU from the final offsetsassociated with the top LCU.

The current LCU includes the luma component and the chroma component.The chroma component further includes the Cb component and the Crcomponent.

When the deblocked pixels 202 corresponds to the luma component of thecurrent LCU, the minimum band cost is a luma minimum band cost and theedge cost associated with each edge SAO type is a luma edge cost. Thecandidate offsets corresponding to the minimum band cost are candidateoffsets corresponding to the luma minimum band cost. The candidateoffsets associated with each edge category combined to form the edge SAOtype are candidate offsets corresponding to each luma edge cost.

Also, when the deblocked pixels 202 corresponds to the luma component ofthe current LCU, the left merge cost is a luma left merge cost and thetop merge cost is a luma top merge cost.

When the deblocked pixels 202 corresponds to the chroma component of thecurrent LCU, the minimum band cost is a chroma minimum band cost and theedge cost associated with each edge SAO type is a chroma edge cost. Thecandidate offsets corresponding to the minimum band cost are candidateoffsets corresponding to the chroma minimum band cost. The candidateoffsets associated with each edge category combined to form the edge SAOtype are candidate offsets corresponding to each chroma edge cost.

Also, when the deblocked pixels 202 corresponds to the chroma componentof the current LCU, the left merge cost is a chroma left merge cost andthe top merge cost is a chroma top merge cost. In addition, each of thefinal left SAO type and the final top type includes a final luma SAOtype and a final chroma SAO type.

In one embodiment, the SAO encoder 200 is first provided with deblockedpixels 202 corresponding to the luma component of the current LCUfollowed by deblocked pixels 202 corresponding to the Cb component andin the end the SAO encoder 200 is provided the deblocked pixels 202corresponding to the Cr component. The SC block 206, the RDO block 208,the SAO type block 210 and the merge mode block 212 processes thesedeblocked pixels 202 in a serial fashion. Thus, all these blocks processthe deblocked pixels corresponding to the luma component followed by thedeblocked pixels corresponding to the chroma component. This is alsoenabled by the functionality of the decision block 216 as describedlater in the description.

In an embodiment, a data generated by the SAO type block 210 and themerge mode block 212 are stored in a buffer in the SAO encoder 200. Inanother embodiment, data generated by the SAO type block 210 and themerge mode block 212 are stored in a buffer in the decision block 216.

The decision block 216 receives the following (but not limited to) fromthe merge mode block 212; the luma left merge cost, the chroma leftmerge cost, the luma top merge cost, the chroma top merge cost, finaloffsets corresponding to the final left SAO type and the final offsetscorresponding to the final top SAO type.

The decision block 216 receives the following (but not limited to) fromthe SAO type block 210; the luma minimum band cost, the luma edge costassociated with each edge SAO type, the chroma minimum band cost, thechroma edge cost associated with each edge SAO type and the candidateoffsets corresponding to each of the luma minimum band cost, the lumaedge cost, the chroma minimum band cost and the chroma edge cost.

The decision block 216 generates an output 218 based on inputs receivedfrom the SAO type block 210 and the merge mode block 212. The output 218is a set of final offsets corresponding to the current LCU. Theoperation of the decision block 216 is explained later in thedescription in connection with FIG. 5 .

FIG. 3(a) illustrates a block diagram of a RDO (rate distortionoptimization) block 300, according to an embodiment. The RDO block 300is similar in connection and operation to the RDO block 208 illustratedin FIG. 2 . The RDO block 300 includes an RD (rate distortion) costestimation block 310. The RD cost estimation block 310 receives a countof a number of deblocked pixels (N) 302 in each category and anestimated error (E) 304 in each category. An increment block 308receives a candidate offset 306 and the increment block 308 is coupledto the RD cost estimation block 310. The RD cost estimation block 310also receives a constant (λ) 314. In one version, the constant (λ) 314is predefined by a user. In another version, the constant (λ) 314 isselected based on parameters of a video encoder. The RD cost estimationblock 310 is also coupled to the sign unit 312.

A selector 316 is coupled to the RD cost estimation block 310. A minimumunit 318 and an offset unit 320 are coupled to the selector 316. Theminimum unit 318 generates a minimum RD cost 322 and the offset unit 320generates a corresponding offset 324. A sign unit 312 receives theestimated error (E) 304 and is coupled to the offset unit 320. The RDOblock 300 may include one or more additional components known to thoseskilled in the relevant art and are not discussed here for simplicity ofthe description.

The operation of the RDO block 300 illustrated in FIG. 3(a) is explainednow. For a category, the RD cost estimation block 310 receives the countof the number of deblocked pixels (N) 302 in the category and theestimated error (E) 304 in that category. A value of the candidateoffset 306 is between a maximum candidate offset and a minimum candidateoffset. The RDO block 300 determines a set of candidate offsets for thecategory. In an example, the set of candidate offsets are integers from0 to +7.

The RD cost estimation block 310 estimates a rate distortion (RD) costfor each candidate offset of the set of candidate offsets determined foreach category. In one example, the candidate offset 306 has an initialvalue of 0. The increment block 308 increments the value of thecandidate offset 306 by a defined integer. In an example, the incrementblock 308 increments the value of the candidate offset 306 by one. Thus,when the candidate offset 306 has an initial value of 0, an output ofthe increment block 308 is an integer value from 0 to +7.

The RD cost estimation block 310 is explained later in the descriptionin connection with FIG. 3(b). For a first candidate offset 306, the RDcost estimation block 310 estimates a first RD cost using the count ofthe number of deblocked pixels (N) 302 in a category, the estimatederror (E) 304 in that category and the constant (λ) 314. The first RDcost is received by the selector 316. The minimum unit 318 stores avalue of the first RD cost and the offset unit 320 stores correspondingcandidate offset for which the first RD cost is obtained. A secondcandidate offset 306 generated by the increment block 308, in oneexample, is +1. The RD cost estimation block 310 estimates a second RDcost corresponding to the second candidate offset 306 using the count ofthe number of deblocked pixels (N) 302 in the category, the estimatederror (E) 304 in that category and the constant (λ) 314. The second RDcost is received by the selector 316. The selector 316 compares thefirst RD cost and the second RD cost and stores a minimum of the firstRD cost and the second RD cost in the minimum unit 318 and acorresponding candidate offset is stored in the offset unit 320.

In one example, when the first RD cost is less than the second RD cost,the selector 316 stores the first RD cost in the minimum unit 318 andthe corresponding candidate offset is stored in the offset unit 320. Theprocess is repeated for all candidate offsets of the set of candidateoffsets determined for the category. It is to be noted that a candidateoffset of the set of candidate offsets is between a maximum candidateoffset and a minimum candidate offset. In an embodiment, a value of themaximum candidate offset and the minimum candidate offset are predefinedfor the RDO block 300.

When a minimum RD cost of the estimated RD costs is determined for acategory, a candidate offset corresponding to the minimum RD cost isstored in the offset unit 320. The sign unit 312 receives a sign of theerror in each category. The sign unit 312 modifies a sign of thecandidate offset stored in the offset unit 320. For example, when a signof the estimated error (E) 304 in a category is negative, the sign unit312 changes a sign of the corresponding candidate offset (stored in theoffset unit 320) to negative for which the minimum RD cost is obtained.The minimum unit 318 generates the minimum RD cost 322 and the offsetunit 320 generates the corresponding offset 324 for a given category.

In one version, the RDO block 300 checks a sign of the candidate offset324 generated for the given category. If the sign of the candidateoffset 324 is non-compliant with the HEVC standard, the RDO block 300generates a predefined candidate offset and the corresponding minimum RDcost is estimated for the predefined candidate offset. For example, whenthe sign of the candidate offset 324 is non-compliant with the HEVCstandard, the RDO block 300 generates 0 as candidate offset and acorresponding minimum RD cost.

In one example, the RDO block 300 is used to estimate a minimum RD cost322 for each category of the plurality of categories. In anotherexample, a plurality of RDO blocks are used in the SAO encoder (forexample SAO encoder 200) and an RDO block of the plurality of RDO blocksis used to estimate a minimum RD cost 322 for a category. In yet anotherexample, a number of RDO block 300 in the SAO encoder is equal to atotal number of band categories and edge categories and each RDO block300 estimates a minimum RD cost 322 for a category.

FIG. 3(b) illustrates a block diagram of an RD (rate distortion) costestimation block 310, according to an embodiment. The RD cost estimationblock 310 receives the count of a number of deblocked pixels (N) 302 ineach category, the estimated error (E) 304 in each category, thecandidate offset 306 and the constant (λ) 314. A first look-up table 352and a second look-up table 360 receive the candidate offset 306. A firstmultiplier 354 receives the candidate offset 306 and the estimated error(E) 304. A second multiplier 356 is coupled to the first look-up table352 and receives the count of the number of deblocked pixels (N) 302.

A multiply unit 357 is coupled to the first multiplier 354. A subtractor358 is coupled to the second multiplier 356 and the multiply unit 357. Afirst adder 363 is coupled to the second look-up table 360 and receivesa sign input 361. A third multiplier 362 is coupled to the first adder363 and receives the constant (λ) 314. In one version, the constant (λ)314 is predefined by a user. In another version, the constant (λ) 314 isselected based on parameters of a video encoder. A second adder 364 iscoupled to the third multiplier 362 and the subtractor 358. The secondadder 364 generates the RD cost 366. The RD cost estimation block 310may include one or more additional components known to those skilled inthe relevant art and are not discussed here for simplicity of thedescription.

The operation of the RD cost estimation block 310 illustrated in FIG.3(b) is explained now. The RD cost estimation block 310 estimates an RDcost for a category using the count of number of deblocked pixels (N)302 in the category, the estimated error (E) 304 in that category andthe constant (λ) 314. According to an embodiment, the RD cost (J) isdefined as:J=((N×O ²−2×|E|×O)+λR)  (1)where, O is the candidate offset 306 and R is a bitrate data.

The first look-up table 352 stores a value of O² corresponding to thecandidate offset 306. The second look-up table 360 stores a value of thebitrate data (R) corresponding to the candidate offset 306. The bitratedata (R) represents a number of bits required by an entropy coder (forexample, entropy coder 108 illustrated in FIG. 1 ) to transmit a symbolgenerated by a video encoder (for example, video encoder 100 illustratedin FIG. 1 ).

The first multiplier 354 multiplies an absolute value of the estimatederror (E) 304 and the candidate offset 306. The second multiplier 356multiplies the count of the number of deblocked pixels (N) 302 and O²received from the first look-up table 352. The multiply unit 357multiply a set of bits received from the first multiplier 354. Thesubtractor 358 subtracts an output of the multiply unit 357 from anoutput of the second multiplier 356.

The first adder 363 receives the sign input 361. The sign input 361indicates the sign of the estimated error (E) 304 for a category. Thefirst adder 363, in one example, increments the bitrate data (R) when asign of the estimated error (E) 304 for a category is negative and doesnot alter the bitrate data (R) when a sign of the estimated error (E)304 for a category is positive. The third multiplier 362 multiplies thebitrate data (R) received from the first adder 363 and the constant (λ)314. An output of the third multiplier 362 is added to an output of thesubtractor 358 by the second adder 364 to generate the RD cost (J) whichis defined by equation 1. In an example embodiment, the RD cost (J) isestimated using equation 1 (irrespective of the components illustratedin FIG. 3(b)), and wherein the bitrate data (R) is received from thesecond look-up table 360.

In an embodiment, for a given category, multiple RD cost estimationblocks are utilized and each RD cost estimation block is used toestimate RD cost associated with an offset of the set of offsetsdetermined for the given category. In another embodiment, the RD costestimation block 310 is used to estimate RD cost associated with eachcandidate offset of the set of candidate offsets for the given category.

FIG. 4(a) illustrates a block diagram of a SAO (sample adaptive offset)type block 400, according to an embodiment. The SAO type block 400 issimilar in connection and operation to the SAO type block 210illustrated in FIG. 2 . The SAO type block 400 receives a minimum RDcost and the corresponding offset for each category. The SAO type block400 is explained using 32 band categories and 16 edge categories. Thespecifically disclosed number of band categories and edge categories isprovided to explain the logical flow and are understood not to limit thescope of the present disclosure.

The SAO type block 400 generates a set of band SAO types such the eachband SAO type of the set of band SAO types includes a set of bandcategories. In one example, when the 32 band categories are B0, B1, B2till B31, the set of band SAO types generated by the SAO type block 400are BO0, BO1, BO2 till BO28, where BO is a start band of band SAO type.For example, the band categories B0, B1, B2 and B3 are combined to formband SAO type BO0 and B0 is a start band of band SAO type BO0.Similarly, the band categories B1, B2, B3 and B4 are combined to formband SAO type BO1 and B1 is the start band of SAO type BO1. The set ofcategories combined to form a SAO type is exemplary and it is understoodthat different combinations of categories are apparent and well withinthe spirit and scope of the disclosure

The SAO type block 400 generates a set of edge SAO types such that eachedge SAO type of the set of edge SAO type includes a set of edgecategories. The four edge types are 0 degree, 90 degree, 135 degree and45 degree. Each of the four edge type is further sub-divided into fouredge categories. In another example, the set of edge SAO types generatedby the SAO type block 400 are EO 0 degrees, EO 90 degrees, EO 135degrees and EO 45 degrees. The four edge categories corresponding to theedge type 0 degrees are combined to form edge SAO type EO 0 degrees.Similarly, the four edge categories corresponding to the edge type 90degrees are combined to form edge SAO type EO 90 degrees.

The SAO type block 400 receives the minimum RD cost corresponding toeach band category (B_Min) 408 and the minimum RD cost corresponding toeach edge category (E_min) 410. The SAO type block 400 includes multiplecost estimation modules such as 402B1, 402B2 till 402B28, 402E1, 402E2,402E3 and 402E4. A cost estimation module estimates a band costassociated with a band SAO type when a minimum RD cost associated witheach band forming the band SAO type is provided to the cost estimationmodule. The cost estimation module also estimates an edge costassociated with an edge SAO type when a minimum RD cost associated witheach edge forming the edge SAO type is provided to the cost estimationmodule.

The cost estimation module is explained later in the description inconnection with FIG. 4(b). The cost estimation modules 402B1, 402B2 till402B28 estimates a band cost associated with band SAO types BO0, BO1till BO28 respectively. Similarly, the cost estimation modules 402E1,402E2, 402E3 and 402E4 estimates an edge cost associated with edge SAOtypes EO 0 degrees, EO 90 degrees, EO 135 degrees and EO 45 degreesrespectively.

The SAO type block 400 includes a selector 415. The selector 415 iscoupled to the cost estimation modules 402B1, 402B2 till 402B28. Theselector 415 receives the band cost associated with band SAO types BO0,BO1 till BO28. The selector 415 determines a minimum band cost of theestimated band costs associated with band SAO types BO0, BO1 till BO28.The SAO type block 400 generates a BO_min output 420. The BO_min output420 includes the minimum band cost, a set of band categories combined toform the band SAO type for which the minimum band cost is obtained andcorresponding candidate offsets associated with each band category ofthe set of band categories.

For example, when a band cost estimated for band SAO type BOO is minimumof all the estimated band costs for band SAO types BO0, BO1 till BO28,the minimum band cost is equal to the band cost associated with the bandSAO type BO0. The SAO type block 400 generates the BO_min output 420which includes the minimum band cost i.e. band cost associated with theband SAO type BOO, a set of band categories combined to form the bandSAO type BO0 i.e. B0, B1, B2 and B3, and the candidate offsetscorresponding to B0, B1, B2 and B3.

The SAO type block 400 also generates EO0 output 422 that includes theedge cost associated with edge SAO types EO 0 degrees and thecorresponding candidate offsets associated with each edge categorycombined to form the edge SAO type EO 0 degrees. The SAO type block 400generates EO90 output 424 that includes the edge cost associated withedge SAO types EO 90 degrees and the corresponding candidate offsetsassociated with each edge category combined to form the edge SAO type EO90 degrees.

The SAO type block 400 also generates EO135 output 426 that includes theedge cost associated with edge SAO types EO 135 degrees and thecorresponding candidate offsets associated with each edge categorycombined to form the edge SAO type EO 135 degrees. The SAO type block400 generates EO45 output 428 that includes the edge cost associatedwith edge SAO types EO 45 degrees and the corresponding candidateoffsets associated with each edge category combined to form the edge SAOtype EO 45 degrees.

FIG. 4(b) illustrates a block diagram of a cost estimation module 450,according to an embodiment. The cost estimation module 450 is similar toat least one of the cost estimation modules 402B1, 402B2 till 402B28,402E1, 402E2, 402E3 and 402E4 in connections and operation. The costestimation module 450 receives four inputs J1, J2, J3 and J4. A firstsummer 452 receives the four inputs J1, J2, J3 and J4. A look-up table462 receives a SAO type input 464 and a sub-type input 466 and generatesa bitrate data (R) 465. A multiplier 468 receives the bitrate date (R)465 and a constant (λ) 470. In one version, the constant (λ) 470 ispredefined by a user. In another version, the constant (λ) 470 isselected based on parameters of a video encoder. A second summer 472 iscoupled to the first summer 452 and the multiplier 468. The secondsummer 472 generates an output (J) 475. The cost estimation module 450may include one or more additional components known to those skilled inthe relevant art and are not discussed here for simplicity of thedescription.

The operation of the cost estimation module 450 illustrated in FIG. 4(b)is explained now. In one example, the four inputs J1, J2, J3 and J4 area minimum RD cost associated with each band forming the band SAO type.In another example, the four inputs J1, J2, J3 and J4 are a minimum RDcost associated with each edge forming the edge SAO type.

For example, the cost estimation module 450 receives a minimum cost RDcost associated with B0, B1, B2 and B3 that form the band SAO type BO0.In a further example, the cost estimation module 450 receives a minimumRD cost associated with the four edge categories corresponding to theedge type 0 degrees that form the edge SAO type EO 0 degrees. The firstsummer 452 sums the four inputs J1, J2, J3 and J4 to generate an output(S).

The SAO type input 464 indicates if the four inputs J1, J2, J3 and J4belong to band categories or edge categories. The sub-type input 466indicates a set of band categories that form a band SAO type or a set ofedge categories that form an edge SAO type. The look-up table 462generates the bitrate data (R) 465 based on the SAO type input 464 andthe sub-type input 466. The multiplier 468 multiplies the bitrate data(R) 465 and the constant (k) 470.

The second summer 472 sums an output of the multiplier 468 and theoutput (S) of the first summer 452. The output (J) 475 generated by thesecond summer 472 is defined as:J=S+λR  (2)where, S represents a sum of the minimum RD cost corresponding to a SAOtype.

In one example, the output (J) 475 is the band cost associated with aband SAO type when the four inputs J1, J2, J3 and J4 are a minimum RDcost associated with each band forming the band SAO type. In anotherexample, the output (J) 475 is the edge cost associated with an edge SAOtype when the four inputs J1, J2, J3 and J4 are a minimum RD costassociated with each edge forming the edge SAO type.

FIG. 5 illustrates a block diagram of a decision block 500, according toan embodiment. The decision block 500 is similar in connection andoperation to the decision block 216 (illustrated in FIG. 2 ) inconnections and operation. The decision block 500 is explained using 32band categories and 16 edge categories. The specifically disclosednumber of band categories and edge categories is provided to explain thelogical flow and are understood not to limit the scope of the presentdisclosure.

A luma comparator 530 in the decision block 500 receives a luma minimumband cost (Luma_J_Bmin) 502, a luma edge cost associated with each edgeSAO type 504 and a SAO disable cost (J_SAO_D) 506. A luma edge costassociated with edge SAO type 0 degree is Luma_J_E0 and a luma edge costassociated with edge SAO type 90 degrees is Luma_J_E90. A luma edge costassociated with SAO type 135 degree is Luma_J_E135 and a luma edge costassociated with edge SAO type 45 degree is Luma_J_E45.

A chroma comparator 535 in the decision block 500 receives a chromaminimum band cost (Chroma_J_Bmin) 512, a chroma edge cost associatedwith each edge SAO type 514 and the SAO disable cost (J_SAO_D) 506. Achroma edge cost associated with edge SAO type 0 degree is Chroma_J_E0and a chroma edge cost associated with edge SAO type 90 degrees isChroma_J_E90. A chroma edge cost associated with edge SAO type 135degree is Chroma_J_E135 and a chroma edge cost associated with edge SAOtype 45 degree is Chroma_J_E45. Each of the chroma minimum band cost(Chroma_J_Bmin) 512 and the chroma edge cost associated with each edgeSAO type 514 includes at least one of a Cb component and a Cr component.

The decision block 500 also receives candidate offsets corresponding toeach of the luma minimum band cost (Luma_J_Bmin) 502, the luma edge costassociated with each edge SAO type 504, the chroma minimum band cost(Chroma_J_Bmin) 512 and the chroma edge cost associated with each edgeSAO type 514.

A first summer 536 in the decision block 500 receives a luma left mergecost (Luma_J_MerL) 522 and a chroma left merge cost (Chroma_J_MerL) 524.A second summer 538 in the decision block 500 receives a luma top mergecost (Luma_J_MerT) 526 and a chroma top merge cost (Chroma_J_MerT) 528.Each of the chroma left merge cost (Chroma_J_MerL) 524 and the chromatop merge cost (Chroma_J_MerT) 528 includes at least one of a Cbcomponent and a Cr component.

A third summer 539 is coupled to the luma comparator 530 and the chromacomparator 535. A final comparator 540 is coupled to the first summer536, the second summer 538 and the third summer 539. The finalcomparator 540 is coupled to a multiplexer 545. The multiplexer 545receives final offsets corresponding to the final left SAO type 544 andfinal offsets corresponding to the final top SAO type 546. A buffer 542is coupled to the luma comparator 530 and the chroma comparator 535. Thebuffer 542 is also coupled to the multiplexer 545. The multiplexer 545generates an output 550.

The operation of the decision block 500 illustrated in FIG. 5 isexplained now. The luma comparator 530 selects a minimum of the lumaminimum band cost (Luma_J_Bmin) 502, the luma edge cost associated witheach edge SAO type 504 and the SAO disable cost (J_SAO_D) 506. The lumacomparator 530 generates a best luma cost. The chroma comparator 535selects a minimum of the chroma minimum band cost (Chroma_J_Bmin) 512,the chroma edge cost associated with each edge SAO type 514 and the SAOdisable cost (J_SAO_D) 506. The chroma comparator 535 generates a bestchroma cost. The third summer 539 adds the best luma cost and the bestchroma cost to generate a joint cost.

The buffer 542 receives offsets corresponding to the best luma cost andoffsets corresponding to the best chroma cost. The offsets correspondingto the best luma cost are best luma offsets and the offsetscorresponding to the best chroma cost are best chroma offsets. The bestluma offsets includes at least one of offsets corresponding to the SAOdisable cost (J_SAO_D) 506, candidate offsets corresponding to the lumaminimum band cost (Luma_J_Bmin) 502 and candidate offsets correspondingto luma edge cost associated with each edge SAO type 504.

The best chroma offsets includes at least one of the offsetscorresponding to the SAO disable cost (J_SAO_D) 506, candidate offsetscorresponding to the chroma minimum band cost (Chroma_J_Bmin) 512 andcandidate offsets corresponding to chroma edge cost associated with eachedge SAO type 514.

In one example, the offsets corresponding to the SAO disable cost(J_SAO_D) 506 have zero value. In another example, when the best lumacost is equal to the SAO disable cost (J_SAO_D) 506, no luma offsetscorresponding to the current LCU are generated. Similarly, when the bestchroma cost is equal to the SAO disable cost (J_SAO_D) 506, no chromaoffsets corresponding to the current LCU are generated. In an additionalexample, when at least one of the best luma cost and the best chromacost is equal to the SAO disable cost (J_SAO_D) 506, the SAO encoder 200is deactivated.

The first summer 536 adds the luma left merge cost (Luma_J_MerL) 522 andthe chroma left merge cost (Chroma_J_MerL) 524 to generate a joint leftmerge cost. The second summer 538 adds the luma top merge cost(Luma_J_MerT) 526 and the chroma top merge cost (Chroma_J_MerT) 528 togenerate a joint top merge cost.

The final comparator 540 receives the joint cost, the joint left mergecost and the joint top merge cost. The final comparator 540 selects aminimum of the joint cost, the joint left merge cost and the joint topmerge cost to generate a final cost.

The multiplexer 545 is controlled by the final comparator 540. When thefinal cost is equal to the joint left merge cost, the output 550 of themultiplexer 545 are the final offsets corresponding to the final leftSAO type 544. When the final cost is equal to the joint top merge cost,the output 550 of the multiplexer 545 are the final offsetscorresponding to the final top SAO type 546. When the final cost isequal to the joint cost, the output 550 of the multiplexer 545 are thebest luma offsets and the best chroma offsets. The output 550 representsa final offsets corresponding to the current LCU in a SAO encoder.

The SAO encoder 200 is able to provide a best offset for each SAO typein real time. The SAO encoder 200 selects a SAO type which results inminimal distortion between the deblocked pixels 202 and the currentpixels 204. The SAO encoder 200 has low complexity as all the processessuch as statistics collection, parameter estimation, cost estimationsare optimized and simple. Thus, the SAO encoder 200 reduces thedistortion in image transmitted of the video encoder (such as videoencoder 100) and thus provides a video with high quality and PSNR. Inone embodiment, 0.15 mm² of silicon area is utilized to perform 4K videoencoding at 60FPS (frames per second) using the 28 nm LP process node.In another embodiment, the processes of the SAO encoder 200 areimplemented on a fixed point programmable device such as DSP (digitalsignal processor). The SAO encoder 200 achieves bit rate reduction inHEVC. The SAO encoder 200 improves visual quality and maintainscompliance with the constraints set by the HEVC standard.

FIG. 6 is an example environment in which various aspect of the presentdisclosure may be implemented. As shown, the environment may comprise,for example, one or more video cameras 610, computers 620, personaldigital assistants (PDA) 630, mobile devices 640, televisions 650, videoconference systems 660, video streaming systems 680, TV broadcastingsystems 670 and communication networks/channels 690.

The video cameras 610 are configured to take continuous pictures andgenerate digital video, a signal comprising sequence of image frames.The video cameras 610 are configured to process the image frames forefficient storage and/or for transmission over the communicationnetworks/channels 690. The computers 620, PDAs 630 and the mobiledevices 640 are configured to encode the video signals for transmissionand to decode encoded video signals received from the communicationnetworks/channels 690. The video streaming systems 680 is configured toencode video signal and to transmit the encoded video signals over thecommunication networks/channels 690 responsive to a received requestand/or asynchronously. The television broadcasting systems 670 areconfigured to process video signals in accordance with one or morebroadcast technologies and to broadcast the processed video signals overthe communication networks/channels 690. The video conference systems660 are configured to receive a video signal from one or moreparticipating/conferencing end-terminals (not shown) and to convert orcompress the video signal for broadcasting or for transmitting to otherparticipating user terminals. The television broadcasting systems 670are configured to receive encoded video signals from one or moredifferent broadcasting centers (or channels), to decode each videosignal and to display the decoded video signals on a display device (notshown).

As shown in FIG. 6 , the devices and systems 610-680 are coupled tocommunication networks/channels 690. Communication networks/channels 690supports an exchange of video signal encoded in accordance with one ormore video encoding standards such as, but not limited to, H.263,H.264/AEC, and HEVC (H.266), for example. Accordingly, the devices andsystems 610-680 are required to process (encode and/or decode) videosignals complying with such standards. The systems and devices 610-680are implemented with one or more functional units that are configured toperform signal processing, transmitting and/or receiving of videosignals from communication networks/channels 690. When each device inthe described environment performs video coding or decoding, one or moreembodiments described in this disclosure are used.

FIG. 7 illustrates a method 700 of generating final offsets in a SAOencoder, according to an embodiment. The method 700 depicted in the flowdiagram may be executed by, for example, SAO encoder 200 explained withreference to FIG. 2 . Operations of the flowchart, and combinations ofoperation in the flowchart, may be implemented by, for example,hardware, firmware, a processor, circuitry and/or a different deviceassociated with the execution of software that includes one or morecomputer program instructions. The operations of the method 700 aredescribed herein with help of the SAO encoder 200. However, theoperations of the method 700 can be described and/or practiced by usinga system other than the SAO encoder 200. The method 700 starts at step702.

At step 702, a set of deblocked pixels and a set of original pixels arereceived. For example, the SC block 206 receives the set of deblockedpixels and the set of original pixels. The set of original pixelscorresponds to a current LCU. The current LCU includes a luma componentand a chroma component. The chroma component further includes a Cbcomponent and a Cr component. At step 704, each deblocked pixel of theset of deblocked pixels is categorized in at least one of a plurality ofband categories and a plurality of edge categories. In one example, theSAO encoder 200 includes 32 band categories and 16 edge categories.

At step 706, a number of deblocked pixels in each category of theplurality of band categories and the plurality of edge categories arecounted. An error in each category is estimated from a differencebetween a deblocked pixel of the set of deblocked pixels andcorresponding original pixel of the set of original pixels, at step 708.

At step 710, a sign of the error in each category is determined. In anexample, the RDO block 208 determines a sign of the error in eachcategory. The sign is a positive sign or a negative sign. At step 712, aset of candidate offsets associated with each category is determined. Avalue of a candidate offset of the set of candidate offsets is between amaximum candidate offset and a minimum candidate offset. In an example,when a video input processed by the SAO encoder 200 is an 8 bit input,the set of candidate offsets are integers from 0 to +7.

A rate distortion (RD) cost associated with each candidate offset of theset of candidate offsets determined for each category is estimated atstep 714. In one version, the RD cost associated with each candidateoffset is estimated using the count of the number of deblocked pixels inthe category and an absolute value of the estimated error in thatcategory. A bitrate data from a look-up table stored in the SAO encoder200 is also used for estimating the RD cost associated with eachcandidate offset. At step 716, a minimum RD cost is determined of theestimated RD costs for each category. A record of the candidate offsetfor which the minimum RD cost is obtained for a category is alsomaintained. In a further example, a sign of the corresponding candidateoffset, for which the minimum RD cost is obtained, is modified based onthe sign of the estimated error in each category. The minimum RD cost isused to generate the final offsets for a SAO encoder (for example SAOencoder 200).

The SAO encoder 200, the RDO block 208, the SAO type block 210, themerge mode block 212 and the decision block 216 may be enabled usingsoftware and/or using transistors, logic gates, and electrical circuits(for example, integrated circuit circuitry such as ASIC circuitry).Various embodiments of the present disclosure may include one or morecomputer programs stored or otherwise embodied on a computer-readablemedium, wherein the computer programs are configured to cause aprocessor or computer to perform one or more operations. Acomputer-readable medium storing, embodying, or encoded with a computerprogram, or similar language, may be embodied as a tangible data storagedevice storing one or more software programs that are configured tocause a processor or computer to perform one or more operations. Suchoperations may be, for example, any of the steps or operations describedherein.

In some embodiments, the computer programs may be stored and provided toa computer using any type of non-transitory computer readable media.Non-transitory computer readable media include any type of tangiblestorage media. Examples of non-transitory computer readable mediainclude magnetic storage media (such as floppy disks, magnetic tapes,hard disk drives, etc.), optical magnetic storage media (e.g.magneto-optical disks), CD-ROM (compact disc read only memory), CD-R(compact disc recordable), CD-R/W (compact disc rewritable), DVD(Digital Versatile Disc), BD (Blu-ray (registered trademark) Disc), andsemiconductor memories (such as mask ROM, PROM (programmable ROM), EPROM(erasable PROM), flash ROM, RAM (random access memory), etc.).

Additionally, a tangible data storage device may be embodied as one ormore volatile memory devices, one or more non-volatile memory devices,and/or a combination of one or more volatile memory devices andnon-volatile memory devices. In some embodiments, the computer programsmay be provided to a computer using any type of transitory computerreadable media. Examples of transitory computer readable media includeelectric signals, optical signals, and electromagnetic waves. Transitorycomputer readable media can provide the program to a computer via awired communication line (e.g. electric wires, and optical fibers) or awireless communication line.

In the foregoing discussion, the terms “connected” means at least eithera direct electrical connection between the devices connected or anindirect connection through one or more passive intermediary devices.The term “circuit” means at least either a single component or amultiplicity of passive or active components, that are connectedtogether to provide a desired function. The term “signal” means at leastone current, voltage, charge, data, or other signal. Also, the terms“connected to” or “connected with” (and the like) are intended todescribe either an indirect or direct electrical connection. Thus, if afirst device is coupled to a second device, that connection can bethrough a direct electrical connection, or through an indirectelectrical connection via other devices and connections.

One having ordinary skill in the art will understand that the presentdisclosure, as discussed above, may be practiced with steps and/oroperations in a different order, and/or with hardware elements inconfigurations which are different than those which are disclosed.Therefore, although the disclosure has been described based upon thesepreferred embodiments, it should be appreciated that certainmodifications, variations, and alternative constructions are apparentand well within the spirit and scope of the disclosure. In order todetermine the metes and bounds of the disclosure, therefore, referenceshould be made to the appended claims.

What is claimed is:
 1. A method comprising: determining a set ofcandidate offsets associated with a sample adaptive offset (SAO)category; estimating a rate distortion (RD) cost associated with eachcandidate offset of the set of candidate offsets for the SAO category;estimating a SAO disable RD cost associated with disabling a SAO encoderfor the category; determining a best RD cost; and deactivating the SAOencoder for the category in response to determining that the best RDcost is equal to the SAO disable cost.
 2. The method of claim 1, whereinestimating the RD cost associated with ach candidate offset is based onbitrate data.
 3. The method of claim 1, further comprising: applying adeblocking filler to a first pixel to create a first deblocked pixel;estimating a first error based on a difference between the firstdeblocked pixel and the first pixel; determining a sign of the firsterror; and modifying a sign of a first candidate offset based on thesign of the first error.
 4. A video encoding system comprising: an inputto receive video input data; and a microprocessor coupled to the inputand configured to: determine a set of candidate offsets associated witha sample adaptive offset (SAO) category; estimate a rate distortion (RD)cost associated with each candidate offset of the set of candidateoffsets for the SAO category; estimate a SAO disable RD cost associatedwith disabling a SAO encoder for the category; determine a best RD cost;and deactivate the SAO encoder for the category in response todetermining that the best RD cost is equal to the SAO disable cost. 5.The video encoding system of claim 4, wherein estimating the RD costassociated with each candidate offset is based on bitrate data.
 6. Thevideo encoding system of claim 4, wherein the microprocessor isconfigured to encode the video input data by: applying a deblockingfiller to a first pixel to create a first deblocked pixel; estimating afirst error based on a difference between the first deblocked pixel andthe first pixel; determining a sign of the estimated first error; andmodifying a sign of a first candidate offset corresponding to theestimated RD cost that is determined to be a minimum RD cost based onthe sign of the estimated first error.
 7. The method of claim 1, whereinestimating the RD cost associated with each candidate offset is based ona count of a number of deblocked pixels in the SAO category and anabsolute value of an estimated error for the SAO category.
 8. The methodof claim 1, wherein determining the set of candidate offsets comprisesdetermining a first candidate offset with a band category anddetermining a second candidate offset with an edge category, whereinestimating the RD cost associated with each candidate offset comprisesestimating a first RD cost associated with the first candidate offsetand estimating a second RD cost associated with the second candidateoffset, and wherein determining the best RD cost comprises comparing thefirst RD cost, the second RD cost, and the SAO disable cost.
 9. Themethod of claim 1, wherein determining the best RD cost comprisesdetermining a best luma RD cost, and wherein the method furthercomprises: determining a best chroma RD cost; determining a joint RDcost based on the best luma RD cost and the best chroma RD cost; andselecting a final cost by comparing the joint RD cost and a merge cost.10. The video encoding system of claim 4, wherein to estimate the RDcost associated with each candidate offset, the microprocessor isconfigured to estimate the RD cost associated with each candidate offsetbased on a count of a number of deblocked pixels in the SAO category andan absolute value of an estimated error for the SAO category.
 11. Thevideo encoding system of claim 4, wherein to determine the set ofcandidate offsets, the microprocessor is configured to determine a firstcandidate offset with a band category and determine a second candidateoffset with an edge category, wherein to estimate the RD cost associatedwith each candidate offset, the microprocessor is configured to estimatea first RD cost associated with the first candidate offset and estimatea second RD cost associated with the second candidate offset, andwherein to determine the best RD cost, the microprocessor is configuredto compare the first RD cost, the second RD cost, and the SAO disablecost.
 12. The video encoding system of claim 4, wherein to determine thebest RD cost, the microprocessor is configured to determine a best lumaRD cost, and wherein the microprocessor is further configured to:determine a best chroma RD cost; determine a joint RD cost based on thebest luma RD cost and the best chroma RD cost; and select a final costby comparing the joint RD cost and a merge cost.
 13. A non-transitorycomputer-readable medium having executable instructions stored thereon,configured to be executable by one or more processors for causing theone or more processors to: determine a set of candidate offsetsassociated with a sample adaptive offset (SAO) category; estimate a ratedistortion (RD) cost associated with each candidate offset of the set ofcandidate offsets for the SAO category; estimate a SAO disable RD costassociated with disabling a SAO encoder for the category; determine abest RD cost; and deactivate the SAO encoder for the category inresponse to determining that the best RD cost is equal to the SAOdisable cost.
 14. The non-transitory computer-readable medium of claim13, wherein the instructions to estimate the RD cost associated witheach candidate offset comprise instructions to estimate the RD costassociated with each candidate offset based on bitrate data.
 15. Thenon-transitory computer-readable medium of claim 13, wherein theinstructions are executable by the one or more processors for furthercausing the one or more processors to: apply a deblocking filter to afirst pixel to create a first deblocked pixel; estimate a first errorbased on a difference between the first deblocked pixel and the firstpixel; determine a sign of the estimated first error; and modify a signof a first candidate offset corresponding to the estimated RD cost thatis determined to be a minimum RD cost based on the sign of the estimatedfirst error.
 16. The non-transitory computer-readable medium of claim13, wherein the instructions to estimate the RD cost associated witheach candidate offset comprise instructions to estimate the RD costassociated with each candidate offset based on a count of a number ofdeblocked pixels in the SAO category and an absolute value of anestimated error for the SAO category.
 17. The non-transitorycomputer-readable medium of claim 13, wherein the instructions todetermine the set of candidate offsets comprise instructions todetermine a first candidate offset with a band category and determine asecond candidate offset with an edge category, wherein the instructionsto estimate the RD cost associated with each candidate offset compriseinstructions to estimate a first RD cost associated with the firstcandidate offset and estimate a second RD cost associated with thesecond candidate offset, and wherein the instructions to determine thebest RD cost comprise instructions to compare the first RD cost, thesecond RD cost, and the SAO disable cost.
 18. The non-transitorycomputer-readable medium of claim 13, wherein the instructions todetermine the best RD cost comprise instructions to determine a bestluma RD cost, and wherein the instructions are executable by the one ormore processors for further causing the one or more processors to:determine a best chroma RD cost; determine a joint RD cost based on thebest luma RD cost and the best chroma RD cost; and select a final costby comparing the joint RD cost and a merge cost.